# """
# @Project: Rebar
# @File: routers.py
# @Author: hzc
# @Date: 2023/4/11 19:01
# """
# # 订单管理
# from fastapi import APIRouter, Header, Query
#
# # from model.db.mapper import add_order, get_orders
# # from model.params import OrderInfoParam
# # from utils import SuccessCode, success_res, objs_to_dict
#
# order_router = APIRouter(prefix="/orders", tags=['订单管理'])
#
#
# @order_router.post("", name="添加订单")
# async def _add_order(order_info: OrderInfoParam, token=Header("token")):
#     order = add_order(order_info)
#     return success_res({
#         'order_id': order.order_id
#     }, SuccessCode.POST)
#
#
# @order_router.get("", name="分页获取订单信息")
# async def _get_orders(
#         page_num: int = Query(default=1, ge=1, title="页码"),
#         page_size: int = Query(default=10, ge=5, le=20, title="每页数据量"),
#         token=Header("token")
# ):
#     orders = get_orders(page_num, page_size)
#     if orders is None:
#         return success_res(None, SuccessCode.DATA_ZERO)
#     return success_res({
#         'orders': objs_to_dict(orders, except_key=['order_details']),
#         'length': len(orders)
#     }, SuccessCode.GET)
